#ifndef DATA_STRUCTURE_GRAPH_H
#define DATA_STRUCTURE_GRAPH_H

#include <iostream>
#include <cstring>

#define MVNum 100
#define MaxInt 32767
typedef char verType;
typedef int ArcType;
using namespace std;

class Graph {
protected:
    int vexNum, arcNum;//图的点数和边数

    virtual void inputNode(int i) = 0;

    virtual void inputArc() = 0;

    virtual void inputArc(verType v1, verType v2, ArcType w) = 0;

    virtual verType findNode(int i) = 0;

    int findVexIdx(verType vex) {
        for (int i = 0; i < vexNum; ++i) {
            if (findNode(i) == vex) {
                return i;
            }
        }
        cout << "findVexIdx error" << endl;
        return 0;
    }

public:
    Graph(int vexNum, int arcNum) : vexNum(vexNum), arcNum(arcNum) {}

    void create() {
        cout << "输入点信息:";
        for (int i = 0; i < vexNum; ++i) {
            inputNode(i);
        }
        cout << "输入" << arcNum << "条数据:点,点,边值:" << endl;
        for (int i = 0; i < arcNum; ++i) {
            inputArc();
        }
    }
};

class NearDge {
public:
    int adjvexIdx;
    ArcType w;
};

class Edge {
public:
    int v1;
    int v2;
    ArcType w;

    Edge(int v1, int v2, ArcType w) : v1(v1), v2(v2), w(w) {}
};

#endif //DATA_STRUCTURE_GRAPH_H
